<!-- *ngIf -->
<button (click)="flag = !flag">点击切换flag</button>
<!-- 相当于vue中的v-if指令 -->
<div *ngIf="flag">flag is true.</div>
<div *ngIf="!flag">flag is false.</div>
<hr />
<ng-template [ngIf]="flag"
  >Content to render when condition is true.</ng-template
>
<hr />
<!-- 相当于vue中的v-if,v-else指令 -->
<div *ngIf="flag; else noFlag">flag is true</div>
<ng-template #noFlag>flag is false</ng-template>
<hr>
<div *ngIf="flag; then thenFlag else elseFlag"></div>
<ng-template #thenFlag>flag is true</ng-template>
<ng-template #elseFlag>flag is false</ng-template>
<hr>
<div *ngIf="flag as value; else elseFlag">{{value}}</div>
<ng-template #elseFlag>flag is false</ng-template>
<hr>
<!-- 低版本的ngElse只能是ng-template标签 -->
<div *ngIf="flag as value; else elseFlag">{{value}}</div>
<!-- <ng-template #elseFlag>flag is false</ng-template> -->
<p #elseFlag>flag is false</p>
